package com.frxuexi.lib_base.net

import com.frxuexi.lib_base.entity.NoticeBean
import com.frxuexi.lib_base.entity.ParkBean
import com.frxuexi.lib_base.entity.ParkBeanItem
import com.frxuexi.lib_base.entity.RepairBean
import com.frxuexi.lib_base.entity.RepairBeanItem
import com.frxuexi.lib_base.entity.Res
import com.frxuexi.lib_base.entity.UserBean
import com.frxuexi.lib_base.entity.VisitBean
import com.frxuexi.lib_base.entity.VisitBeanItem
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path
import retrofit2.http.Query

interface ApiService {

    @POST("/api/user/login")
    suspend fun login(@Query("username")username:String,@Query("password")password:String):Res<UserBean>

//    公告
    @GET("/api/announcements")
    suspend fun getNotices(@Query("page")page:Int,@Query("size")size:Int):Res<NoticeBean>

    //车位
    @GET("/api/parking-spaces/type/{spaceType}")
    suspend fun getParkByType(@Path("spaceType")spaceType:String):Res<ParkBean>

    @GET("/api/parking-spaces/status/{spaceStatus}")
    suspend fun getParkByStatus(@Path("spaceStatus")spaceStatus:String):Res<ParkBean>

    @GET("/api/parking-spaces/area/{areaId}")
    suspend fun getParkByArea(@Path("areaId")areaId:Int):Res<ParkBean>

    @POST("/api/parking-spaces")
    suspend fun addPark(@Body body: RequestBody):Res<ParkBeanItem>

    @GET("/api/parking-spaces/{id}")
    suspend fun getParkById(@Path("id")id:Int):Res<ParkBeanItem>

    @PUT("/api/parking-spaces/{id}")
    suspend fun updatePark(@Path("id")id:Int,@Body body: RequestBody):Res<ParkBeanItem>

    @DELETE("/api/parking-spaces/{id}")
    suspend fun deletePark(@Path("id")id:Int):Res<Boolean>

    //维修
    @GET("/api/repair-orders")
    suspend fun getRepairs():Res<RepairBean>

    @GET("/api/repair-orders/order-number/{orderNumber}")
    suspend fun getRepairByNum(@Path("orderNumber")orderNumber:String):Res<RepairBeanItem>

    @GET("/api/repair-orders/search")
    suspend fun getRepairByUname(@Query("repairName")repairName:String):Res<RepairBean>

    @GET("/api/repair-orders/{id}")
    suspend fun getRepairById(@Path("id")id:Int):Res<RepairBeanItem>

    @PUT("/api/repair-orders/{id}")
    suspend fun updateRepair(@Path("id")id:Int,@Body body: RequestBody):Res<RepairBeanItem>

    @DELETE("/api/repair-orders/{id}")
    suspend fun deleteRepair(@Path("id")id: Int):Res<Boolean>

    @POST("/api/repair-orders")
    suspend fun addRepair(@Body body: RequestBody):Res<RepairBeanItem>

    //来访
    @GET("/api/visit-appointments")
    suspend fun getVisits():Res<VisitBean>

    @GET("/api/visit-appointments/status/{status}")
    suspend fun getVisitByStatus(@Path("status")status:String):Res<VisitBean>

    @GET("/api/visit-appointments/search/name")
    suspend fun getVisitByName(@Query("name")name:String):Res<VisitBean>

    @GET("/api/visit-appointments/{id}")
    suspend fun getVisitById(@Path("id")id:Int):Res<VisitBeanItem>

}